﻿@model Solution.Business.Entities.Contact

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<center><h4 style="color:red;">Điền đầy đủ thông tin và gửi đến ban quản trị sanchinhchu.vn <br />
    ĐT : 0123456789
</h4></center>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    function validateForm() {
        var x = document.forms["form1"]["Contact.Mail"].value;
        var atpos = x.indexOf("@@");
        var dotpos = x.lastIndexOf(".");
        if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length) {
            alert("Not a valid e-mail address");
        return false;
}
}
</script>

@using (Html.BeginForm(null, null, FormMethod.Post, new { name = "form1", onsubmit = "return validateForm();" })) {
    @Html.ValidationSummary(true)
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Name, "Họ và tên :")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
            <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Address, "Địa chỉ :")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
            <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Tel, "Số điện thoại :")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Tel)
            @Html.ValidationMessageFor(model => model.Tel)
            <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Mail, "Email :")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Mail)
            @Html.ValidationMessageFor(model => model.Mail)
            <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Detail, "Nội dung :")
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Detail, new { @id = "ckeDetail" })
            <span style="color:red;">*</span>
            <script type="text/javascript">
                CKEDITOR.replace("ckeDetail");
            </script>
            
        </div>

        <p>
            <input type="submit" value="Gửi" />
        </p>
}

